import {
getHTMLTextDir,
getTranslation,
type StrictModeLocaleMap,
} from 'intlayer';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import type { LocalParams, Next14LayoutIntlayer } from 'next-intlayer';
const inter = Inter({ subsets: ['latin'] });
export { generateStaticParams } from 'next-intlayer';
export const generateMetadata = ({
params: { locale },
}: LocalParams): Metadata => {
const t = <T extends string>(content: StrictModeLocaleMap<T>) =>
getTranslation(content, locale);
const title = t<string>({
en: 'Create Next App',
fr: 'Créer une application Next.js',
es: 'Crear una aplicación Next.js',
});
const description = t({
en: 'Generated by create next app',
fr: 'Généré par create next app',
es: 'Generado por create next app',
});
return {
title,
description,
};
};
const LocaleLayout: Next14LayoutIntlayer = ({
children,
params: { locale },
}) => (
<html lang={locale} dir={getHTMLTextDir(locale)}>
<body className={inter.className}>{children}</body>
</html>
);
export default LocaleLayout;